<template>
  <section class="main">
    <ul class="todo-list">
      <li class="todo" v-for="(item, index) in list" :key="item.id">
        <div class="view">
          <span class="index">{{ index + 1 }}.</span>
          <label>{{ item.name }}</label>
          <!-- 子传父  1.子传 -->
          <button class="destroy" @click="$emit('del', item.id)"></button>
        </div>
      </li>
    </ul>
  </section>
</template>

<script>
export default {
  // 父传子  2.子收
  props: ['list']
}
</script>

<style lang="scss" scoped></style>
